﻿using System;
using System.Collections.Generic;
using System.Text;

namespace _19策略模式僵尸案例
{
    /// <summary>
    /// 抽象角色类
    /// </summary>
    abstract class Charator
    {
        public string Name { get; set; }

        private SpeedStrategy m_speedStrategy;
        public SpeedStrategy SpeedBehaving {
            get { return m_speedStrategy; } 
            set 
            {
                if (value != null)
                    m_speedStrategy = value;
            }
        }

        public Charator(string name,SpeedStrategy speedStrategy)
        {
            Name = name;
            SpeedBehaving = speedStrategy;
        }

        //移动方法
        public virtual void Move()
        {
            //速度抽象行为
            SpeedBehaving.AlgorithmInterface();
        }

        public virtual void Attack()
        {
            Console.WriteLine("基类攻击");
        }

        //显示模型
        public abstract void Show();
    }
}
